package gui;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.swing.ButtonGroup;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JRadioButton;
import javax.swing.JRadioButtonMenuItem;

public class MenyBar extends JMenuBar {
	private JMenu sourceMenu;
	private JMenu optionMenu;
	
	   private class MyRadioButtonMenuItem extends JRadioButtonMenuItem
	      implements ActionListener {
	      public MyRadioButtonMenuItem(String text) {
	         super(text);
	         addActionListener(this);
	      }
	      public void actionPerformed(ActionEvent e) {
	         System.out.println("Item clicked: "+e.getActionCommand());
	      }

	   }

/*
	public static void main(String []ds){
		i
	}
	*/
	public MenyBar(){
		initJMenu();
		initJMenuOptions();
		this.add(sourceMenu);

	}

	private void initJMenuOptions() {
	
		ButtonGroup group = new ButtonGroup();
		MyRadioButtonMenuItem sourceItem1 = new MyRadioButtonMenuItem("DB");
		group.add(sourceItem1);
		sourceItem1.setSelected(true);
		sourceMenu.add(sourceItem1);
		
		MyRadioButtonMenuItem sourceItem2 = new MyRadioButtonMenuItem("XML");
		group.add(sourceItem2);
		sourceMenu.add(sourceItem2);
		
	}

	private void initJMenu() {
		
		sourceMenu = new JMenu("Source");
		//sourceMenu.addMouseListener(new JMenuMouseListner());
		optionMenu = new JMenu("Options");
		
		//jMenuMap.put("Source", new JMenu("Source"));
		//jMenuMap.put("Options", new JMenu("Options"));
		
		
	}
}
